//Scripts
var hide_box = false;
/*function checkOnline(){
		$.post('getMethod.php',{actionName:'checkOnair'},function(html){
			//alert(html);
			if($("#header_onair").html()!=html){
				$("#header_onair").html(html);
			}
			setTimeout("checkOnline()",300000)
		})
	}*/
	
$(document).ready(function(){
	//setTimeout("checkOnline()",300000);
//change selected class
	
	$("ul#navigation li a").hover(function(){$(this).parent().parent().parent('li.submenu').children('a:first').addClass('current');},function(){$(this).parent().parent().parent('li.submenu').children('a:first').removeClass('current');});
	$("ul#navigation li a").click(function(){
		$("ul#navigation li a").removeClass('selected');
		$(this).addClass('selected');
		$(this).parent().parent().parent('li.submenu').children('a:first').addClass('selected');
		//alert($(this).parent().parent().parent('li.submenu').children('a:first').html());
	});
//AJax load	
	$("a.ajaxload").live('click',function(){
		//clearTimeout(timeout);
		if(hide_box){
			$("#smriti-open_box,#smriti-floating_box").show();
			hide_box = false;
		}
		href = $(this).attr('href');
		window.location.hash = href;
		loadingpage = href.replace('index.php','pages.php');
		//window.scrollTo(0, 0);
		$("#footer div.highlights").hide();
		$('#content').html("<img src='images/loader.gif' class='loading_image' align='middle' />");
		$('#content').load(loadingpage+"&loader=ajax",function(){$("#footer div.highlights").show();});
		return false;
	});
	
//Ajax load for top navigation
		
	/*$("a.top_navigation_ajax").bind('click',function(){
		//clearTimeout(timeout);
		if(hide_box){
			$("#smriti-open_box,#smriti-floating_box").show();
		}
		href = $(this).attr('rel');
		if(href!=''){
			window.location.hash = href;
			loadingpage = href.replace('index.php','pages.php');
			//window.scrollTo(0, 0);
			$("#footer div.highlights").hide();
			$('#content').html("<img src='images/loader.gif' class='loading_image' align='middle' />");
			$('#content').load(loadingpage+"&loader=ajax",function(){$("#footer div.highlights").show();});
		}
		//return false;
	});
*/
	
//Live radio
/* left side update strat */
	setTimeout("$('div.smriti-button img').trigger('click')",5000);
	$("div.smriti-button img").click(function(){
	 	var wid=$('#smriti-floating_box').width();
		$("#smriti-floating_box").animate( { left:"-"+wid+"px" },700, function(){
					//$(this).hide();
					$("#smriti-open_box").animate({ left:"0px"},400);
					
		});
			
	});
	
	$("#smriti-open_box .smriti-open_button img").click(function(){
	 	//var wid=$('#smriti-floating_box').width();
		$("#smriti-open_box").animate( { left:"-106px" },400, function(){
					//$(this).hide();
					$("#smriti-floating_box").animate({ left:"0px"},700);
					
		});
			
	});
	
	/*Player switch*/
	var curr_player = 'media';
	//QUicktime player
	$("img#quick").live('click',function(){
		$("div#player").html("<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab' height='45' width='250'> <param name='controller' value='true'><param name='autoplay' value='true'><param name='volume' value='80'><param name='cache' value='false'><param name='src' value='http://nepalnews.com/live/ujyaalofm.php'><embed controller='true' autoplay='true' volume='50' cache='false' type='video/quicktime' pluginspage='http://www.apple.com/quicktime/download/' src='http://nepalnews.com/live/ujyaalofm.php' height='45' width='250'></object>");
	$(this).attr('src','images/'+curr_player+'.jpg').attr('id',curr_player);
	curr_player = 'quick';
	});
	
	//Media player
	$("img#media").live('click',function(){
		$("div#player").html('<object id="Player1" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="45" standby="Loading Microsoft Windows Media Player components..."  type="application/x-oleobject" width="250"><param name="uiMode" value="full" /><param name="URL" value="http://nepalnews.com/live/ujyaalofm.php" /><param name="autoStart" value="true" /> <param name="enableContextMenu" value="false" /> <param name="playCount" value="9999" /> <embed type="application/x-mplayer2" src="http://nepalnews.com/live/ujyaalofm.php" id="Player2" showcontrols="1" showdisplay="0" autostart="1"  showstatusbar="1" height="45" width="250" class="" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"  /> </embed> </object>');
	$(this).attr('src','images/'+curr_player+'.jpg').attr('id',curr_player);
	curr_player = 'media';
	});
	
	//Flash player
	$("img#flash").live('click',function(){
		$("div#player").html('<embed type="application/x-shockwave-flash" src="system/swf/player_radio.swf?id=1" width="250" height="45" style="undefined" id="ply" name="ply" bgcolor="#FFFFFF" quality="high" allowfullscreen="false" allowscriptaccess="always" flashvars="file=http://nepalnews.com/live/ujyaalofm.php/;stream.nsv&amp;type=mp3&amp;volume=50&amp;autostart=true">');
	$(this).attr('src','images/'+curr_player+'.jpg').attr('id',curr_player);
	curr_player = 'flash';
	});
	
	//Real player
	$("img#real").live('click',function(){
		$("div#player").html('<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="250" height="45" id="RVOCX"><param name="src" value="http://nepalnews.com/live/ujyaalofm.php"> <param name="autostart" value="true"><param name="controls" value="All"><param name="console" value="video"><embed src="http://nepalnews.com/live/ujyaalofm.php" width="250" height="45" type="audio/x-pn-realaudio-plugin" autostart="true" controls="All" console="video"></object>');
	$(this).attr('src','images/'+curr_player+'.jpg').attr('id',curr_player);
	curr_player = 'real';
	});	
	
	//Hiding quick menu onclick body
	/*var mouse_is_inside = false;

    $('#quick_menus,#quick_menu').hover(function(){ 
        mouse_is_inside=true; 
		}, function(){ 
			mouse_is_inside=false; 
		});

    $(document).click(function(){ 
        if(! mouse_is_inside) $('#quick_menus').slideUp('slow');
    });*/


});